Integrand size = 29, antiderivative size = 79 \[ \int \cos ^2(e+f x) (a+a \sin (e+f x)) (c+d \sin (e+f x)) \, dx=\frac {1}{8} a (4 c+d) x-\frac {a (c+d) \cos ^3(e+f x)}{3 f}+\frac {a (4 c+d) \cos (e+f x) \sin (e+f x)}{8 f}-\frac {a d \cos ^3(e+f x) \sin (e+f x)}{4 f} \]
1/8*a*(4*c+d)*x-1/3*a*(c+d)*cos(f*x+e)^3/f+1/8*a*(4*c+d)*cos(f*x+e)*sin(f* x+e)/f-1/4*a*d*cos(f*x+e)^3*sin(f*x+e)/f
Time = 0.87 (sec) , antiderivative size = 99, normalized size of antiderivative = 1.25 \[ \int \cos ^2(e+f x) (a+a \sin (e+f x)) (c+d \sin (e+f x)) \, dx=\frac {a \cos (e+f x) \left (-8 (c+d)-\frac {6 (4 c+d) \arcsin \left (\frac {\sqrt {1-\sin (e+f x)}}{\sqrt {2}}\right )}{\sqrt {\cos ^2(e+f x)}}+3 (4 c-d) \sin (e+f x)+8 (c+d) \sin ^2(e+f x)+6 d \sin ^3(e+f x)\right )}{24 f} \]
(a*Cos[e + f*x]*(-8*(c + d) - (6*(4*c + d)*ArcSin[Sqrt[1 - Sin[e + f*x]]/S qrt[2]])/Sqrt[Cos[e + f*x]^2] + 3*(4*c - d)*Sin[e + f*x] + 8*(c + d)*Sin[e + f*x]^2 + 6*d*Sin[e + f*x]^3))/(24*f)
Time = 0.39 (sec) , antiderivative size = 80, normalized size of antiderivative = 1.01, number of steps used = 7, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.241, Rules used = {3042, 3339, 3042, 3148, 3042, 3115, 24}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \cos ^2(e+f x) (a \sin (e+f x)+a) (c+d \sin (e+f x)) \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \cos (e+f x)^2 (a \sin (e+f x)+a) (c+d \sin (e+f x))dx\) |
\(\Big \downarrow \) 3339 |
\(\displaystyle \frac {1}{4} (4 c+d) \int \cos ^2(e+f x) (\sin (e+f x) a+a)dx-\frac {d \cos ^3(e+f x) (a \sin (e+f x)+a)}{4 f}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {1}{4} (4 c+d) \int \cos (e+f x)^2 (\sin (e+f x) a+a)dx-\frac {d \cos ^3(e+f x) (a \sin (e+f x)+a)}{4 f}\) |
\(\Big \downarrow \) 3148 |
\(\displaystyle \frac {1}{4} (4 c+d) \left (a \int \cos ^2(e+f x)dx-\frac {a \cos ^3(e+f x)}{3 f}\right )-\frac {d \cos ^3(e+f x) (a \sin (e+f x)+a)}{4 f}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {1}{4} (4 c+d) \left (a \int \sin \left (e+f x+\frac {\pi }{2}\right )^2dx-\frac {a \cos ^3(e+f x)}{3 f}\right )-\frac {d \cos ^3(e+f x) (a \sin (e+f x)+a)}{4 f}\) |
\(\Big \downarrow \) 3115 |
\(\displaystyle \frac {1}{4} (4 c+d) \left (a \left (\frac {\int 1dx}{2}+\frac {\sin (e+f x) \cos (e+f x)}{2 f}\right )-\frac {a \cos ^3(e+f x)}{3 f}\right )-\frac {d \cos ^3(e+f x) (a \sin (e+f x)+a)}{4 f}\) |
\(\Big \downarrow \) 24 |
\(\displaystyle \frac {1}{4} (4 c+d) \left (a \left (\frac {\sin (e+f x) \cos (e+f x)}{2 f}+\frac {x}{2}\right )-\frac {a \cos ^3(e+f x)}{3 f}\right )-\frac {d \cos ^3(e+f x) (a \sin (e+f x)+a)}{4 f}\) |
-1/4*(d*Cos[e + f*x]^3*(a + a*Sin[e + f*x]))/f + ((4*c + d)*(-1/3*(a*Cos[e + f*x]^3)/f + a*(x/2 + (Cos[e + f*x]*Sin[e + f*x])/(2*f))))/4
3.10.35.3.1 Defintions of rubi rules used
Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d* x]*((b*Sin[c + d*x])^(n - 1)/(d*n)), x] + Simp[b^2*((n - 1)/n) Int[(b*Sin [c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && IntegerQ[ 2*n]
Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x _)]), x_Symbol] :> Simp[(-b)*((g*Cos[e + f*x])^(p + 1)/(f*g*(p + 1))), x] + Simp[a Int[(g*Cos[e + f*x])^p, x], x] /; FreeQ[{a, b, e, f, g, p}, x] && (IntegerQ[2*p] || NeQ[a^2 - b^2, 0])
Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x _)])^(m_.)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(-d)* (g*Cos[e + f*x])^(p + 1)*((a + b*Sin[e + f*x])^m/(f*g*(m + p + 1))), x] + S imp[(a*d*m + b*c*(m + p + 1))/(b*(m + p + 1)) Int[(g*Cos[e + f*x])^p*(a + b*Sin[e + f*x])^m, x], x] /; FreeQ[{a, b, c, d, e, f, g, m, p}, x] && EqQ[ a^2 - b^2, 0] && NeQ[m + p + 1, 0]
Time = 0.30 (sec) , antiderivative size = 72, normalized size of antiderivative = 0.91
method | result | size |
parallelrisch | \(-\frac {\left (\frac {8 \left (c +d \right ) \cos \left (3 f x +3 e \right )}{3}-8 \sin \left (2 f x +2 e \right ) c +d \sin \left (4 f x +4 e \right )+8 \left (c +d \right ) \cos \left (f x +e \right )-16 f x c -4 f x d +\frac {32 c}{3}+\frac {32 d}{3}\right ) a}{32 f}\) | \(72\) |
derivativedivides | \(\frac {a d \left (-\frac {\left (\cos ^{3}\left (f x +e \right )\right ) \sin \left (f x +e \right )}{4}+\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{8}+\frac {f x}{8}+\frac {e}{8}\right )-\frac {a c \left (\cos ^{3}\left (f x +e \right )\right )}{3}-\frac {a d \left (\cos ^{3}\left (f x +e \right )\right )}{3}+a c \left (\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )}{f}\) | \(96\) |
default | \(\frac {a d \left (-\frac {\left (\cos ^{3}\left (f x +e \right )\right ) \sin \left (f x +e \right )}{4}+\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{8}+\frac {f x}{8}+\frac {e}{8}\right )-\frac {a c \left (\cos ^{3}\left (f x +e \right )\right )}{3}-\frac {a d \left (\cos ^{3}\left (f x +e \right )\right )}{3}+a c \left (\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )}{f}\) | \(96\) |
risch | \(\frac {a x c}{2}+\frac {a x d}{8}-\frac {a c \cos \left (f x +e \right )}{4 f}-\frac {a \cos \left (f x +e \right ) d}{4 f}-\frac {a d \sin \left (4 f x +4 e \right )}{32 f}-\frac {a \cos \left (3 f x +3 e \right ) c}{12 f}-\frac {a \cos \left (3 f x +3 e \right ) d}{12 f}+\frac {a c \sin \left (2 f x +2 e \right )}{4 f}\) | \(102\) |
norman | \(\frac {\left (\frac {1}{2} a c +\frac {1}{8} a d \right ) x +\left (2 a c +\frac {1}{2} a d \right ) x \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (2 a c +\frac {1}{2} a d \right ) x \left (\tan ^{6}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (3 a c +\frac {3}{4} a d \right ) x \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (\frac {1}{2} a c +\frac {1}{8} a d \right ) x \left (\tan ^{8}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )-\frac {2 a c +2 a d}{3 f}-\frac {2 \left (a c +a d \right ) \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{3 f}-\frac {2 \left (a c +a d \right ) \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}-\frac {2 \left (a c +a d \right ) \left (\tan ^{6}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}+\frac {a \left (4 c -d \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{4 f}-\frac {a \left (4 c -d \right ) \left (\tan ^{7}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{4 f}+\frac {a \left (4 c +7 d \right ) \left (\tan ^{3}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{4 f}-\frac {a \left (4 c +7 d \right ) \left (\tan ^{5}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{4 f}}{\left (1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )^{4}}\) | \(294\) |
-1/32*(8/3*(c+d)*cos(3*f*x+3*e)-8*sin(2*f*x+2*e)*c+d*sin(4*f*x+4*e)+8*(c+d )*cos(f*x+e)-16*f*x*c-4*f*x*d+32/3*c+32/3*d)*a/f
Time = 0.28 (sec) , antiderivative size = 72, normalized size of antiderivative = 0.91 \[ \int \cos ^2(e+f x) (a+a \sin (e+f x)) (c+d \sin (e+f x)) \, dx=-\frac {8 \, {\left (a c + a d\right )} \cos \left (f x + e\right )^{3} - 3 \, {\left (4 \, a c + a d\right )} f x + 3 \, {\left (2 \, a d \cos \left (f x + e\right )^{3} - {\left (4 \, a c + a d\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{24 \, f} \]
-1/24*(8*(a*c + a*d)*cos(f*x + e)^3 - 3*(4*a*c + a*d)*f*x + 3*(2*a*d*cos(f *x + e)^3 - (4*a*c + a*d)*cos(f*x + e))*sin(f*x + e))/f
Leaf count of result is larger than twice the leaf count of optimal. 199 vs. \(2 (71) = 142\).
Time = 0.17 (sec) , antiderivative size = 199, normalized size of antiderivative = 2.52 \[ \int \cos ^2(e+f x) (a+a \sin (e+f x)) (c+d \sin (e+f x)) \, dx=\begin {cases} \frac {a c x \sin ^{2}{\left (e + f x \right )}}{2} + \frac {a c x \cos ^{2}{\left (e + f x \right )}}{2} + \frac {a c \sin {\left (e + f x \right )} \cos {\left (e + f x \right )}}{2 f} - \frac {a c \cos ^{3}{\left (e + f x \right )}}{3 f} + \frac {a d x \sin ^{4}{\left (e + f x \right )}}{8} + \frac {a d x \sin ^{2}{\left (e + f x \right )} \cos ^{2}{\left (e + f x \right )}}{4} + \frac {a d x \cos ^{4}{\left (e + f x \right )}}{8} + \frac {a d \sin ^{3}{\left (e + f x \right )} \cos {\left (e + f x \right )}}{8 f} - \frac {a d \sin {\left (e + f x \right )} \cos ^{3}{\left (e + f x \right )}}{8 f} - \frac {a d \cos ^{3}{\left (e + f x \right )}}{3 f} & \text {for}\: f \neq 0 \\x \left (c + d \sin {\left (e \right )}\right ) \left (a \sin {\left (e \right )} + a\right ) \cos ^{2}{\left (e \right )} & \text {otherwise} \end {cases} \]
Piecewise((a*c*x*sin(e + f*x)**2/2 + a*c*x*cos(e + f*x)**2/2 + a*c*sin(e + f*x)*cos(e + f*x)/(2*f) - a*c*cos(e + f*x)**3/(3*f) + a*d*x*sin(e + f*x)* *4/8 + a*d*x*sin(e + f*x)**2*cos(e + f*x)**2/4 + a*d*x*cos(e + f*x)**4/8 + a*d*sin(e + f*x)**3*cos(e + f*x)/(8*f) - a*d*sin(e + f*x)*cos(e + f*x)**3 /(8*f) - a*d*cos(e + f*x)**3/(3*f), Ne(f, 0)), (x*(c + d*sin(e))*(a*sin(e) + a)*cos(e)**2, True))
Time = 0.32 (sec) , antiderivative size = 74, normalized size of antiderivative = 0.94 \[ \int \cos ^2(e+f x) (a+a \sin (e+f x)) (c+d \sin (e+f x)) \, dx=-\frac {32 \, a c \cos \left (f x + e\right )^{3} + 32 \, a d \cos \left (f x + e\right )^{3} - 24 \, {\left (2 \, f x + 2 \, e + \sin \left (2 \, f x + 2 \, e\right )\right )} a c - 3 \, {\left (4 \, f x + 4 \, e - \sin \left (4 \, f x + 4 \, e\right )\right )} a d}{96 \, f} \]
-1/96*(32*a*c*cos(f*x + e)^3 + 32*a*d*cos(f*x + e)^3 - 24*(2*f*x + 2*e + s in(2*f*x + 2*e))*a*c - 3*(4*f*x + 4*e - sin(4*f*x + 4*e))*a*d)/f
Time = 0.33 (sec) , antiderivative size = 83, normalized size of antiderivative = 1.05 \[ \int \cos ^2(e+f x) (a+a \sin (e+f x)) (c+d \sin (e+f x)) \, dx=\frac {1}{8} \, {\left (4 \, a c + a d\right )} x - \frac {a d \sin \left (4 \, f x + 4 \, e\right )}{32 \, f} + \frac {a c \sin \left (2 \, f x + 2 \, e\right )}{4 \, f} - \frac {{\left (a c + a d\right )} \cos \left (3 \, f x + 3 \, e\right )}{12 \, f} - \frac {{\left (a c + a d\right )} \cos \left (f x + e\right )}{4 \, f} \]
1/8*(4*a*c + a*d)*x - 1/32*a*d*sin(4*f*x + 4*e)/f + 1/4*a*c*sin(2*f*x + 2* e)/f - 1/12*(a*c + a*d)*cos(3*f*x + 3*e)/f - 1/4*(a*c + a*d)*cos(f*x + e)/ f
Time = 11.15 (sec) , antiderivative size = 276, normalized size of antiderivative = 3.49 \[ \int \cos ^2(e+f x) (a+a \sin (e+f x)) (c+d \sin (e+f x)) \, dx=\frac {a\,\mathrm {atan}\left (\frac {a\,\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\left (4\,c+d\right )}{4\,\left (a\,c+\frac {a\,d}{4}\right )}\right )\,\left (4\,c+d\right )}{4\,f}-\frac {\left (a\,c-\frac {a\,d}{4}\right )\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^7+\left (2\,a\,c+2\,a\,d\right )\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^6+\left (a\,c+\frac {7\,a\,d}{4}\right )\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^5+\left (2\,a\,c+2\,a\,d\right )\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^4+\left (-a\,c-\frac {7\,a\,d}{4}\right )\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^3+\left (\frac {2\,a\,c}{3}+\frac {2\,a\,d}{3}\right )\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2+\left (\frac {a\,d}{4}-a\,c\right )\,\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )+\frac {2\,a\,c}{3}+\frac {2\,a\,d}{3}}{f\,\left ({\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^8+4\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^6+6\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^4+4\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2+1\right )}-\frac {a\,\left (4\,c+d\right )\,\left (\mathrm {atan}\left (\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\right )-\frac {f\,x}{2}\right )}{4\,f} \]
(a*atan((a*tan(e/2 + (f*x)/2)*(4*c + d))/(4*(a*c + (a*d)/4)))*(4*c + d))/( 4*f) - ((2*a*c)/3 + (2*a*d)/3 + tan(e/2 + (f*x)/2)^4*(2*a*c + 2*a*d) + tan (e/2 + (f*x)/2)^6*(2*a*c + 2*a*d) + tan(e/2 + (f*x)/2)^2*((2*a*c)/3 + (2*a *d)/3) + tan(e/2 + (f*x)/2)^7*(a*c - (a*d)/4) - tan(e/2 + (f*x)/2)^3*(a*c + (7*a*d)/4) + tan(e/2 + (f*x)/2)^5*(a*c + (7*a*d)/4) - tan(e/2 + (f*x)/2) *(a*c - (a*d)/4))/(f*(4*tan(e/2 + (f*x)/2)^2 + 6*tan(e/2 + (f*x)/2)^4 + 4* tan(e/2 + (f*x)/2)^6 + tan(e/2 + (f*x)/2)^8 + 1)) - (a*(4*c + d)*(atan(tan (e/2 + (f*x)/2)) - (f*x)/2))/(4*f)